
const messageTpl = '<xml>\n' +
    '<ToUserName><![CDATA[<%-toUserName%>]]></ToUserName>' +
    '<FromUserName><![CDATA[<%-fromUserName%>]]></FromUserName>' +
    '<CreateTime><%=createTime%></CreateTime>' +
    '<MsgType><![CDATA[<%=msgType%>]]></MsgType>' +
    '<Content><![CDATA[<%-content%>]]></Content>' +
    '</xml>';

export function text(message) {
    const ejs = require('ejs');
    let reply = {
        toUserName: message.FromUserName,
        fromUserName: message.ToUserName,
        createTime: new Date().getTime(),
        msgType: 'text',
        content: message.Content
    };

    return ejs.render(messageTpl, reply);
}
